import javax.jws.WebService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2025-03-07
 * Time:13:31
 */
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
            IOException {//
        //这个打印显示在tomcat的控制台上，（服务器端显示的内容）
        System.out.println("hello world");
        //把内容显示到页面上,把hollo world字符串作为http响应的body部分
        //会被浏览器显示到页面上
        resp.getWriter().write("hello world");
    }
}
